# 空语句-用来占位，什么也不做 pass
a = 11
if a != 1:
    pass
else:
    print('hello')

# 循环语句
# while
# num = 1
# while num <= 10:
#     print(num)
#     num += 1
#

# 1-10相加
# n = 1
# total = 0
# while n <= 10:
#     total += n
#     n += 1
# print(total)

# 1-5的阶乘之和
# num = 1
# total = 0
# while num <= 5:
#     n = 1
#     sum = 1
#     while n <= num:
#         sum *= n
#         n += 1
#     total += sum
#     num += 1
# print(total)

# for循环
# 打印1-10
# for i in range(1, 11):
#     print(i)
# range是内建函数(begin,end)前闭后开

# 第三个参数可以表示步长
# for i in range(2, 12, 2):
#     print(i)

# 倒着打印
# for i in range(10, 0, -1):
#     print(i)

# 1-100求和
# s = 0
# for i in range(1, 101):
#     s += i
# print(s)

# continue 和 break
# for i in range(1, 11):
#     if i == 5:
#         continue
#     print(i)
#
# for i in range(1, 11):
#     if i == 5:
#         break
#     print(i)

# while True: 死循环
# random.randint(1, 6) 随机数左闭右闭
# sys.exit(0) 程序终止
# time.sleep(1) 暂停1秒
